﻿<UserControl x:Class="BombaJob.Views.JobOffersPanView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
             xmlns:properties="clr-namespace:BombaJob.Properties" 
             xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
             xmlns:beh="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="600">

    <mah:MetroContentControl>
        <Grid>
            <mah:Panorama x:Name="OffersCategories" ItemsSource="{Binding PGOffersCategories}"
                          VerticalAlignment="Stretch" Margin="20"
                          HeaderFontColor="Black">
                <mah:Panorama.ItemTemplate>
                    <DataTemplate>
                        <ListBoxItem Tag="{Binding DataContext, ElementName=ListOffers}">
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Top">
                                <Image Source="{Binding HumanYn, Converter={StaticResource OfferIconConverter}}" Height="21" Width="35" VerticalAlignment="Top" Margin="0,10,8,0"/>
                                <StackPanel>
                                    <TextBlock Text="{Binding Title}" FontSize="24" TextWrapping="Wrap" Margin="12,0,0,0" Foreground="Black" />
                                    <TextBlock Text="{Binding PublishDate, Converter={StaticResource OfferDateLongConverter}}" Foreground="#FFFF8D00" Margin="12,0,0,10" />
                                </StackPanel>
                            </StackPanel>
                            <ListBoxItem.ContextMenu>
                                <ContextMenu
                                    cal:Action.TargetWithoutContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
                                    <MenuItem Header="{x:Static properties:Resources.ctxmenu_View}"
                                              cal:Message.Attach="OffersList_Menu_View($dataContext)"/>
                                    <MenuItem Header="{x:Static properties:Resources.ctxmenu_SendMessage}"
                                              cal:Message.Attach="OffersList_Menu_Message($dataContext)"/>
                                    <MenuItem Header="{x:Static properties:Resources.ctxmenu_MarkAsRead}"
                                              cal:Message.Attach="OffersList_Menu_Mark($dataContext)"/>
                                </ContextMenu>
                            </ListBoxItem.ContextMenu>
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="PreviewMouseLeftButtonUp">
                                    <cal:ActionMessage MethodName="OffersList_SelectionChanged">
                                        <cal:Parameter Value="{Binding}"></cal:Parameter>
                                    </cal:ActionMessage>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </ListBoxItem>
                    </DataTemplate>
                </mah:Panorama.ItemTemplate>
            </mah:Panorama>
        </Grid>
    </mah:MetroContentControl>
</UserControl>
